home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / netinet / RCS / ip.h,v < prev    next >
Text File  |  1989-06-16  |  4KB  |  171 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     88.06.29.15.11.06;  author ouster;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     88.06.21.11.59.27;  author ouster;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @Add ifdefs to keep files from being processed twice.
  27. @
  28. text
  29. @/*
  30.  * Copyright (c) 1982, 1986 Regents of the University of California.
  31.  * All rights reserved.
  32.  *
  33.  * Redistribution and use in source and binary forms are permitted
  34.  * provided that this notice is preserved and that due credit is given
  35.  * to the University of California at Berkeley. The name of the University
  36.  * may not be used to endorse or promote products derived from this
  37.  * software without specific prior written permission. This software
  38.  * is provided ``as is'' without express or implied warranty.
  39.  *
  40.  *    @@(#)ip.h    7.6 (Berkeley) 2/22/88
  41.  */
  42.  
  43. #ifndef _IP
  44. #define _IP
  45.  
  46. /*
  47.  * Definitions for internet protocol version 4.
  48.  * Per RFC 791, September 1981.
  49.  */
  50. #define    IPVERSION    4
  51.  
  52. /*
  53.  * Structure of an internet header, naked of options.
  54.  *
  55.  * We declare ip_len and ip_off to be short, rather than u_short
  56.  * pragmatically since otherwise unsigned comparisons can result
  57.  * against negative integers quite easily, and fail in subtle ways.
  58.  */
  59. struct ip {
  60. #if BYTE_ORDER == LITTLE_ENDIAN 
  61.     u_char    ip_hl:4,        /* header length */
  62.         ip_v:4;            /* version */
  63. #endif
  64. #if BYTE_ORDER == BIG_ENDIAN 
  65.     u_char    ip_v:4,            /* version */
  66.         ip_hl:4;        /* header length */
  67. #endif
  68.     u_char    ip_tos;            /* type of service */
  69.     short    ip_len;            /* total length */
  70.     u_short    ip_id;            /* identification */
  71.     short    ip_off;            /* fragment offset field */
  72. #define    IP_DF 0x4000            /* dont fragment flag */
  73. #define    IP_MF 0x2000            /* more fragments flag */
  74.     u_char    ip_ttl;            /* time to live */
  75.     u_char    ip_p;            /* protocol */
  76.     u_short    ip_sum;            /* checksum */
  77.     struct    in_addr ip_src,ip_dst;    /* source and dest address */
  78. };
  79.  
  80. #define    IP_MAXPACKET    65535        /* maximum packet size */
  81.  
  82. /*
  83.  * Definitions for options.
  84.  */
  85. #define    IPOPT_COPIED(o)        ((o)&0x80)
  86. #define    IPOPT_CLASS(o)        ((o)&0x60)
  87. #define    IPOPT_NUMBER(o)        ((o)&0x1f)
  88.  
  89. #define    IPOPT_CONTROL        0x00
  90. #define    IPOPT_RESERVED1        0x20
  91. #define    IPOPT_DEBMEAS        0x40
  92. #define    IPOPT_RESERVED2        0x60
  93.  
  94. #define    IPOPT_EOL        0        /* end of option list */
  95. #define    IPOPT_NOP        1        /* no operation */
  96.  
  97. #define    IPOPT_RR        7        /* record packet route */
  98. #define    IPOPT_TS        68        /* timestamp */
  99. #define    IPOPT_SECURITY        130        /* provide s,c,h,tcc */
  100. #define    IPOPT_LSRR        131        /* loose source route */
  101. #define    IPOPT_SATID        136        /* satnet id */
  102. #define    IPOPT_SSRR        137        /* strict source route */
  103.  
  104. /*
  105.  * Offsets to fields in options other than EOL and NOP.
  106.  */
  107. #define    IPOPT_OPTVAL        0        /* option ID */
  108. #define    IPOPT_OLEN        1        /* option length */
  109. #define IPOPT_OFFSET        2        /* offset within option */
  110. #define    IPOPT_MINOFF        4        /* min value of above */
  111.  
  112. /*
  113.  * Time stamp option structure.
  114.  */
  115. struct    ip_timestamp {
  116.     u_char    ipt_code;        /* IPOPT_TS */
  117.     u_char    ipt_len;        /* size of structure (variable) */
  118.     u_char    ipt_ptr;        /* index of current entry */
  119. #if BYTE_ORDER == LITTLE_ENDIAN 
  120.     u_char    ipt_flg:4,        /* flags, see below */
  121.         ipt_oflw:4;        /* overflow counter */
  122. #endif
  123. #if BYTE_ORDER == BIG_ENDIAN 
  124.     u_char    ipt_oflw:4,        /* overflow counter */
  125.         ipt_flg:4;        /* flags, see below */
  126. #endif
  127.     union ipt_timestamp {
  128.         n_long    ipt_time[1];
  129.         struct    ipt_ta {
  130.             struct in_addr ipt_addr;
  131.             n_long ipt_time;
  132.         } ipt_ta[1];
  133.     } ipt_timestamp;
  134. };
  135.  
  136. /* flag bits for ipt_flg */
  137. #define    IPOPT_TS_TSONLY        0        /* timestamps only */
  138. #define    IPOPT_TS_TSANDADDR    1        /* timestamps and addresses */
  139. #define    IPOPT_TS_PRESPEC    2        /* specified modules only */
  140.  
  141. /* bits for security (not byte swapped) */
  142. #define    IPOPT_SECUR_UNCLASS    0x0000
  143. #define    IPOPT_SECUR_CONFID    0xf135
  144. #define    IPOPT_SECUR_EFTO    0x789a
  145. #define    IPOPT_SECUR_MMMM    0xbc4d
  146. #define    IPOPT_SECUR_RESTR    0xaf13
  147. #define    IPOPT_SECUR_SECRET    0xd788
  148. #define    IPOPT_SECUR_TOPSECRET    0x6bc5
  149.  
  150. /*
  151.  * Internet implementation parameters.
  152.  */
  153. #define    MAXTTL        255        /* maximum time to live (seconds) */
  154. #define    IPFRAGTTL    60        /* time to live for frags, slowhz */
  155. #define    IPTTLDEC    1        /* subtracted when forwarding */
  156.  
  157. #define    IP_MSS        576        /* default maximum segment size */
  158.  
  159. #endif _IP
  160. @
  161.  
  162.  
  163. 1.1
  164. log
  165. @Initial revision
  166. @
  167. text
  168. @d15 3
  169. d130 2
  170. @
  171.